package st.business.tepth.business.user.busnumber.preholder.repair;

import st.business.tepth.base.OnDataConvertListener;
import st.business.tepth.business.bean.PreWorkInfoBean;

/**
 * Author: shadow
 * Email:  1025431817@qq.com
 * Time:   2019-04-11 15:38
 */

public class PreRepairPresenter extends PreRepairContract.Presenter {
    private final PreRepairContract.View mView;
    private final PreRepairContract.Model mModel;

    public PreRepairPresenter(PreRepairContract.View view) {
        mView = view;
        mModel = new PreRepairModel();
    }

    @Override
    void getInfo(String token, int repairId) {
        addDisposable(mModel.getInfo(token, repairId,
                new OnDataConvertListener<PreWorkInfoBean>() {
                    @Override
                    public void convert(PreWorkInfoBean preWorkInfoBean) {
                        if (preWorkInfoBean != null) {
                            mView.showData(preWorkInfoBean);
                        }
                    }

                    @Override
                    public void error(int code, String msg) {
                        mView.showError(msg);
                    }
                }));
    }
}
